const request = require('../../../../utils/request.js');
const url = require('../../../../utils/url')
const utils = require('../../../../utils/util')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    noLog: 0,
    hasMoreData: false,
    pageSize: 10,
    pageNum: 1,
    type: 'member',
    list: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.getDividendList()
  },

  getDividendList: function () {
    wx.showNavigationBarLoading(); //在当前页面显示导航条加载动画
    var that = this;
    let param = {
      page: this.data.pageNum,
      rows: this.data.pageSize,
      type: this.data.type,
    }
    request.request(url.getdividentlist, param, url.REQUEST_METHOD_GET).then(res => {
      console.log(param, res)
      if (that.data.pageNum == 1) {
        that.setData({
          list: [],
          noLog: 1,
        })
      }
      var contentlistItem = that.data.list;
      if (res.data.data.data.length > 0) {
        var contentlist = res.data.data.data;
        if (contentlist.length < 10) {
          that.setData({
            list: contentlistItem.concat(contentlist),
            hasMoreData: false,
            noLog: 0,
          })
        } else {
          that.setData({
            list: contentlistTem.concat(contentlist),
            hasMoreData: true,
            page: that.data.pageNum + 1,
            noOrder: 0,
          })
        }
      } else {
        that.setData({
          hasMoreData: false,
        })
      }
      wx.hideNavigationBarLoading()
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})